<script type="text/javascript"
	src="http://api.map.baidu.com/api?v=1.5&amp;ak=bao0nBtErnglUggAdSNVoCLY"></script>
<div style='position: relative'>
	<div id='bigMap' class="liulan Box">
		<h3 class="title icon09" onclick='bigMap()'>查看地图</h3>
		<div class="map">
			<div id='container' style='width: 200px; height: 175px'></div>
			<a href="javascript:;" onclick='bigMap()'>查看全图</a>
		</div>
	</div>
</div>

<?php //pr($VenueMap)?>
<?php if(!empty($VenueMap)):?>
<script type="text/javascript">
map = false;
addPoint = <?php echo ($VenueMap['map_point']=='')?'{}':$VenueMap['map_point'] ?>;
$().ready(function(){
    map = new BMap.Map("container");
    map.centerAndZoom(new BMap.Point(addPoint.lng,addPoint.lat), addPoint.zoom);
    map.enableScrollWheelZoom();
    var marker=new BMap.Marker(new BMap.Point(addPoint.lng,addPoint.lat));
    map.addOverlay(marker);
    var licontent="<b><?php echo $VenueMap['title_cn']?></b><br>";
       licontent+="<span><strong>地址：</strong><?php echo $VenueMap['way_address']?></span><br>";
       licontent+="<span class=\"input\"><strong>起点</strong><input style='border:1px solid #000' class=\"outset\" type=\"text\" name=\"origin\" value=\"西安站\"/>";
       licontent+="<input class=\"outset-but\" type=\"button\" value=\"公交\" onclick=\"gotobaidu(1)\" /> <input class=\"outset-but\" type=\"button\" value=\"驾车\"  onclick=\"gotobaidu(2)\"/>";
       licontent+="<a class=\"gotob\" href=\"url=\"http://api.map.baidu.com/direction?destination=latlng:"+marker.getPosition().lat+","+marker.getPosition().lng+"|name:<?php echo $VenueMap['title_cn']?>"+"®ion=陕西"+"&amp;output=html\" target=\"_blank\"></a></span>";
    var hiddeninput="<input type=\"hidden\" value=\""+'西安站'+"\" name=\"region\" /><input type=\"hidden\" value=\"html\" name=\"output\" /><input type=\"hidden\" value=\"driving\" name=\"mode\" /><input type=\"hidden\" value=\"latlng:"+marker.getPosition().lat+","+marker.getPosition().lng+"|name:<?php echo $VenueMap['title_cn']?>"+"\" name=\"destination\" />";
    var content1 ="<form id=\"gotobaiduform\" action=\"http://api.map.baidu.com/direction\" target=\"_blank\" method=\"get\">";
    	content1 += licontent +hiddeninput+"</form>"; 
    var opts1 = { width: 200 };
  
    var  infoWindow = new BMap.InfoWindow(content1, opts1);
	marker.openInfoWindow(infoWindow);
	marker.addEventListener('click',function(){ marker.openInfoWindow(infoWindow);});

});
function bigMap(){
	var $bm = jQuery('#bigMap'); 
	if(!$bm.hasClass('big')){
		$bm.addClass('big').css({position:'absolute','z-index':9999}).animate({
			width:'1000px',
			height:'400px',
			right:'0'
		},function(){
			map.setCenter(new BMap.Point(addPoint.lng,addPoint.lat));
		});
		$('#container').width('100%').height(320);
	}else{
		$('#container').height(180);
		$bm.removeClass('big').animate({
			width:'220px',
			height:'251px',
		},function(){
			$bm.css({position:'static'});
			map.setCenter(new BMap.Point(addPoint.lng,addPoint.lat));
		});
	}
}
function gotobaidu(type)
{
    if($.trim($("input[name=origin]").val())=="")
    {
        alert("请输入起点！");
        return;
    }else{
        if(type==1)
        {
            $("input[name=mode]").val("transit");
            $("#gotobaiduform")[0].submit();
        }else if(type==2)
        {    
            $("input[name=mode]").val("driving");        
            $("#gotobaiduform")[0].submit();
        }
    }
}   
</script>
<?php endif;?>